<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link rel="stylesheet" href="__STATIC__/frame/layui/css/layui.css">
    <link rel="stylesheet" href="__STATIC__/frame/static/css/style.css">
    <link rel="stylesheet" href="__STATIC__/css/maowenke.css">
    <link rel="icon" href="__STATIC__/frame/static/image/code.png">
</head>
<body class="body">
<form action="" method="post" id="form">
    <div class="layui-row" style="margin-top: 15px">
        <div class="layui-col-xs4">
            <select name="classes_id" class="layui-select" style="width: 50%">
                <option value="">选择题目一级分类</option>
                {foreach $class as $value}
                <option value="{$value['id']}">{$value['class_name']}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="layui-row"  style="margin-top: 15px">
        <div class="layui-col-xs4">
            <select name="branch_id" class="layui-select" style="width: 50%">
                <option value="">选择题目二级分类</option>
            </select>
        </div>
    </div>
    <div class="layui-row"  style="margin-top: 15px">
        <div class="layui-col-xs4">
            <select name="three_level_id" class="layui-select" style="width: 50%">
                <option value="">选择题目三级分类</option>

            </select>
        </div>
    </div>
    <div class="layui-row"  style="margin-top: 15px">
        <div class="layui-col-xs4">
            <select name="type" class="layui-select" style="width: 50%">
                {foreach $situation as $value}
                <option value="{$value['id']}">{$value['situation_name']}</option>
                {/foreach}

            </select>
        </div>
    </div>
    <div class="layui-row"  style="margin-top: 15px">
        <div class="layui-col-xs4">
            <input type="file" name="tabl">
        </div>
    </div>
</form>
<div class="layui-row"  style="margin-top: 15px;">
    <div class="layui-col-xs2" style="text-align: center">
        <button class="layui-btn">提交</button>
    </div>
</div>
<div class="layui-row" id="divchuchuo" style="display: none">
    出错的题目
    <table class="layui-table">
        <thead>
            <tr>
                <th>序号</th>
                <th>题干</th>
                <th>答案</th>
                <th>正确答案</th>
                <th>答题思路</th>
                <th>获取金币</th>
                <th>获取经验</th>
                <th>题目难度星等</th>
            </tr>
        </thead>
        <tbody id="chucuo">

        </tbody>
    </table>
</div>
<script src="__STATIC__/frame/layui/layui.all.js" charset="utf-8"></script>
<script src="__STATIC__/js/jquery.3.3.1.min.js" charset="utf-8"></script>
<script src="__STATIC__/js/maowenke.js" charset="utf-8"></script>
<script>

    $("[name=classes_id]").change(function () {
        var $classid = $(this).val();
        if($classid){
            getBranch($classid,"{:url('api/get_Branch')}",$('[name=branch_id]'),$("[name=three_level_id]"),"{:url('api/getBank')}");
        }else{
            layer.msg('请输入题目一级分类');
        }
    });
    $("[name=branch_id]").change(function () {
        var $id = $(this).val();
        getThree_level($id,"{:url('api/getBank')}",$("[name=three_level_id]"));
    });
    $(".layui-btn").click(function () {
        ajaxs($("#form"),"{:url('api/daoru')}",function (data) {
            console.log(data);
            if(data.code==200){
                $("#divchuchuo").hide();
                layer.msg(data.msg);
            }else if(data.data){
                $("#chucuo").empty();
                var $str = '';
                $.each(data.data,function (i,v) {
                    $str +='<tr>' +
                        '<td>'+v[0]+'</td>' +
                        '<td>'+v[1]+'</td>' +
                        '<td>'+v[2]+'</td>' +
                        '<td>'+v[3]+'</td>' +
                        '<td>'+v[4]+'</td>' +
                        '<td>'+v[5]+'</td>' +
                        '<td>'+v[6]+'</td>' +
                        '<td>'+v[7]+'</td>' +
                        '</tr>';
                });
                $("#chucuo").append($str);
                $("#divchuchuo").show();
            }else{
                $("#divchuchuo").hide();
                layer.msg(data.msg);
            }
        });
    });
</script>
</body>
</html>